<?php
error_reporting(E_ALL ^ E_NOTICE);
set_time_limit(0);
$db_name="dinocap2";  
 
$table_name="dinocap2hd";  
 
$connection= @mysql_connect("localhost","root","root") or die(mysql_error());  
 
$db= @mysql_select_db($db_name,$connection) or die (mysql_error());  
 
$logdate =  mysql_query("SELECT DISTINCT whatday FROM `dinocap2hd`");

while($everylogdate = mysql_fetch_array($logdate))
{
	 //  破解用户
	  //$totalisjailbreak_query = mysql_query("SELECT count(isjailbreak)  FROM dinocap2hd  where isjailbreak = '1' and whatday = '$everylogdate[whatday]'");
    //$totalisjailbreak = mysql_fetch_array($totalisjailbreak_query);
//	for( $i=0;$i<count($everylogdate);$i++)
//   游戏总注册人数
    $loginPersonNum_query = mysql_query("SELECT count(DISTINCT deviceid) FROM dinocap2hd where isjailbreak = '0'");

    $loginPersonNum = mysql_fetch_array($loginPersonNum_query);
    //日均活跃人数 wait
    $activePesonrNum_query = mysql_query("select(SELECT count(DISTINCT deviceid)  FROM dinocap2hd where isjailbreak = '0' AND dayPlayTime >2)/(SELECT count( DISTINCT whatday )FROM dinocap2hd)");
    $activePesonrNum = mysql_fetch_array($activePesonrNum_query);


    //  // 日均活跃人次 activePesonrTime 一个人可能多次
    $activePesonrTime_query = mysql_query("select (SELECT count(deviceid)  FROM dinocap2hd where isjailbreak = '0' AND dayPlayTime >2)/(SELECT count( DISTINCT whatday )FROM dinocap2hd)");
    $activePesonrTime = mysql_fetch_array($activePesonrTime_query);
    //日均人均打开次数  //DISTINCT deviceid
    $totalDayPlayTime_query = mysql_query("SELECT avg(dayPlayTime)  FROM dinocap2hd where isjailbreak = '0'");
    $totalDayPlayTime = mysql_fetch_array($totalDayPlayTime_query);

    //  日均游戏时间
    $totalDayTotalTime_query = mysql_query("SELECT avg(dayTotalTime)  FROM dinocap2hd where isjailbreak = '0'");
    $totalDayTotalTime = mysql_fetch_array($totalDayTotalTime_query);

    //  今日平均游戏时间
    //$dayTotalTime_query = mysql_query("SELECT avg(dayTotalTime)  FROM dinocap2hd  where whatday ='$everylogdate[whatday]'");
    // $dayTotalTime = mysql_fetch_array($dayTotalTime_query);
    //	日均金钱获得
    $totalDayGetMoney_query = mysql_query("SELECT avg(dayGetMoney) FROM dinocap2hd where isjailbreak = '0'");
    $totalDayGetMoney = mysql_fetch_array($totalDayGetMoney_query);
    //	日均IAP金钱获得
    $totalDayGetIAPMoney_query = mysql_query("SELECT avg(dayIapMoney) FROM dinocap2hd  where isjailbreak = '0'");
    $totalDayGetIAPMoney = mysql_fetch_array($totalDayGetIAPMoney_query);
    //日均充值

    $totalDayRecharge_query = mysql_query("SELECT avg(dayIapMoney) FROM dinocap2hd where isjailbreak = '0'");
    $totalDayRecharge = mysql_fetch_array($totalDayRecharge_query);

    //日均消费totalDayUsedMoney

    $totalDayUsedMoney_query = mysql_query("SELECT avg(dayUsedMoney)  FROM  dinocap2hd where isjailbreak = '0'");
    $totalDayUsedMoney = mysql_fetch_array($totalDayUsedMoney_query);

    //日均注册人数
    $dayLoginPersonNum_query = mysql_query("select(SELECT count(DISTINCT deviceid) FROM dinocap2hd where isjailbreak = '0' and  firstlogin ='$everylogdate[whatday]')/(SELECT count( DISTINCT whatday )FROM dinocap2hd where isjailbreak = '0')");

    $dayLoginPersonNum = mysql_fetch_array($dayLoginPersonNum_query);

    //totalDayNewusers 每日新注册 DISTINCT
    $totalDayNewusers_query = mysql_query("SELECT count(DISTINCT deviceid)  FROM  dinocap2hd  where firstlogin ='$everylogdate[whatday]' and  isjailbreak = '0'");
    $totalDayNewusers = mysql_fetch_array($totalDayNewusers_query);

    //今日打开次数
   // $dayPlayTime_query = mysql_query("SELECT avg(dayPlayTime)  FROM dinocap2hd  where whatday ='$everylogdate[whatday]'");
    //$dayPlayTime = mysql_fetch_array($dayPlayTime_query);

    //DayActivePesonrNum  每日活跃人数  //  日均dayPlayTime 活跃人数 今日的
    $dayActivePesonrNum_query = mysql_query("SELECT count(DISTINCT deviceid)  FROM dinocap2hd  where whatday ='$everylogdate[whatday]' and  isjailbreak = '0' and whatday <> firstlogin");
    $dayActivePesonrNum = mysql_fetch_array($dayActivePesonrNum_query);


    //dayActivePesonrTime 每日活跃人次
    $dayActivePesonrTime_query = mysql_query("SELECT count(deviceid)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0' AND dayPlayTime >2");
    $dayActivePesonrTime = mysql_fetch_array($dayActivePesonrTime_query);

    //weekActivePesonrNum   每周活跃人数  SELECT * FROM dinocap2hd   where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]')
    $weekActivePesonrNum_query = mysql_query("SELECT count(DISTINCT deviceid)  FROM  dinocap2hd  where  date_add(whatday,interval 2 day) <= '$everylogdate[whatday]'  and YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]')  and  isjailbreak = '0'");
    $weekActivePesonrNum = mysql_fetch_array($weekActivePesonrNum_query);

    //weekLoyalPesonrNum  每周忠诚用户人数
    $weekLoyalPesonrNum_query = mysql_query("SELECT count(DISTINCT deviceid)  FROM  dinocap2hd  where date_add(whatday,interval 3 day) <= '$everylogdate[whatday]' and  YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]')  and  isjailbreak = '0'");
    $weekLoyalPesonrNum = mysql_fetch_array($weekLoyalPesonrNum_query);
    //weekCorePesonrNum   每周核心用户人数
    $weekCorePesonrNum_query = mysql_query("SELECT count(DISTINCT deviceid)  FROM  dinocap2hd  where date_add(whatday,interval 4 day) <= '$everylogdate[whatday]' and  YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]')  and  isjailbreak = '0' AND dayPlayTime >4");
    $weekCorePesonrNum = mysql_fetch_array($weekCorePesonrNum_query);

    //newPayPesonrNum  新增付费人数
    $newPayPesonrNum_query = mysql_query("SELECT count(DISTINCT deviceid)  FROM  dinocap2hd  where dayIapMoney >0 and  whatday ='$everylogdate[whatday]' and  isjailbreak = '0'");
    $newPayPesonrNum = mysql_fetch_array($newPayPesonrNum_query);
    //今日付费次数 paytimes
    $paytimes_query = mysql_query("SELECT sum(dayIap1BuyTimes+dayIap2BuyTimes+dayIap3BuyTimes+dayIap4BuyTimes+dayIap5BuyTimes+dayIap6BuyTimes)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0'");
    $paytimes = mysql_fetch_array($paytimes_query);
    //今日付费用户数 PayPesonrNum
    $PayPesonrNum_query = mysql_query("SELECT count(deviceid)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and dayIapMoney >0 and  isjailbreak = '0'");
    $PayPesonrNum = mysql_fetch_array($PayPesonrNum_query);

    //  今日均人均游戏时间
    $dayTotalTime_query = mysql_query("select (SELECT sum(dayTotalTime)  FROM dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0')/(SELECT count(DISTINCT deviceid)  FROM dinocap2hd  where whatday ='$everylogdate[whatday]' and  isjailbreak = '0' and whatday <> firstlogin)");
    $dayTotalTime = mysql_fetch_array($dayTotalTime_query);

    //  今日均消费金钱总和 DayUsedMoney 
    $dayUsedMoney_query = mysql_query("SELECT sum(dayUsedMoney)  FROM  dinocap2hd   where whatday ='$everylogdate[whatday]' and  isjailbreak = '0'");
    $dayUsedMoney = mysql_fetch_array($dayUsedMoney_query);
    
     //weekPayPesonrNum 周付费用户数 SELECT count( DISTINCT deviceid )
   // FROM dinocap2hd
    //WHERE dayIapMoney >0
    //AND YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' )
    //AND isjailbreak = '0'
    $weekPayPesonrNum_query = mysql_query("SELECT count(distinct deviceid)  FROM  dinocap2hd  where dayIapMoney >0 and  YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and  isjailbreak = '0'");
    $weekPayPesonrNum = mysql_fetch_array($weekPayPesonrNum_query);
    //dayIAPGetMoney  今日人均 IAP 获得金钱
    $dayIAPGetMoney_query = mysql_query("select (SELECT sum(dayIapMoney)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0')/(SELECT count(deviceid)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0' and dayPlayTime > '2' )");
    $dayIAPGetMoney = mysql_fetch_array($dayIAPGetMoney_query);
    //avgDayMoney  今日人均获得金钱
    $avgDayMoney_query = mysql_query("select (SELECT sum(dayGetMoney)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0')/(SELECT count(deviceid)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0' and dayPlayTime > '2' )");
    $avgDayMoney = mysql_fetch_array($avgDayMoney_query);
    //dayNowMoney  今日人均现有金钱
    $dayNowMoney_query = mysql_query("select (SELECT sum(nowMoney)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0')/(SELECT count(deviceid)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and  isjailbreak = '0' and dayPlayTime > '2')");
    $dayNowMoney = mysql_fetch_array($dayNowMoney_query);
    //dayRechargeNum  今日人均充值笔数
    $dayRechargeNum_query = mysql_query("select (SELECT sum(dayIap1BuyTimes+dayIap2BuyTimes+dayIap3BuyTimes+dayIap4BuyTimes+dayIap5BuyTimes+dayIap6BuyTimes)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0')/(SELECT count(deviceid)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0' and dayIapMoney >0)");
    $dayRechargeNum = mysql_fetch_array($dayRechargeNum_query);

    //iap1
    $iap1_query = mysql_query("SELECT sum(dayIap1BuyTimes) FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0' and dayIapMoney >0");
    $iap1 = mysql_fetch_array($iap1_query);
    //iap2
    $iap2_query = mysql_query("SELECT sum(dayIap2BuyTimes)   FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0' and dayIapMoney >0 ");
    $iap2 = mysql_fetch_array($iap2_query);
    //iap3
    $iap3_query = mysql_query("SELECT sum(dayIap3BuyTimes)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0' and dayIapMoney >0");
    $iap3 = mysql_fetch_array($iap3_query);
    //iap4
    $iap4_query = mysql_query("SELECT sum(dayIap4BuyTimes)   FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0' and dayIapMoney >0");
    $iap4 = mysql_fetch_array($iap4_query);
    //iap5
    $iap5_query = mysql_query("SELECT sum(dayIap5BuyTimes)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0' and dayIapMoney >0");
    $iap5 = mysql_fetch_array($iap5_query);
   // iap6
     $iap6_query = mysql_query("SELECT sum(dayIap6BuyTimes)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0' and dayIapMoney >0");
     $iap6 = mysql_fetch_array($iap6_query);
    
    
    
    
    //weekPayARPU 周付费用户ARPU值 =周付费总额/周付费人数
    //总额
     //$weekPayNums_query = mysql_query("SELECT count(dayIapMoney)  FROM  dinocap2hd  where dayIapMoney >0 and  YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and whatday = '$everylogdate[whatday]'");
       // $weekPayNums = mysql_fetch_array($weekPayNums_query);
    
   
    //$weekPayARPU_query = mysql_query("select '$weekPayNums[0]'/'$weekPayPesonrNum[0]'");
    $weekPayARPU_query = mysql_query("select (select sum(dayIapMoney) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and isjailbreak = '0')/(select count(distinct deviceid) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and dayIapMoney > 0 and isjailbreak = '0')");

    $weekPayARPU = mysql_fetch_array($weekPayARPU_query);
    //weekActiveARPU 周活跃用户ARPU值
    
    //$weekActiveARPU_query = mysql_query("select '$weekPayNums[0]'/'$weekActivePesonrNum[0]'");
   $weekActiveARPU_query = mysql_query("select (select sum(dayIapMoney) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and isjailbreak = '0')/(select count(distinct deviceid) from dinocap2hd where  date_add(whatday,interval 2 day) <= '$everylogdate[whatday]' and YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]' ) and isjailbreak = '0' )");
   $weekActiveARPU = mysql_fetch_array($weekActiveARPU_query);
  // $weekActiveARPU = 0;
    
    //weekLogARPU 周登陆用户ARPU值  = 周付费用户/周登陆人数(活跃用户+新用户)  
    //周登陆人数
      //  $weekLodPesonrNums_query = mysql_query("SELECT count(deviceid)  FROM  dinocap2hd  where  YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and whatday = '$everylogdate[whatday]'");
    //   $weekLodPesonrNums_query = mysql_query("select (select count(dayIapMoney) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and isjailbreak = '0')/(select count(distinct deviceid) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and isjailbreak = '0')");
     // $weekLodPesonrNums = mysql_fetch_array($weekLodPesonrNums_query);
   //   $weekLodPesonrNums = 0;
    //
     $weekLogARPU_query = mysql_query("select (select count(dayIapMoney) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and isjailbreak = '0')/(select count(distinct deviceid) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and isjailbreak = '0')");
      $weekLogARPU = mysql_fetch_array($weekLogARPU_query);
    //$weekLogARPU = 0;
    //weekWastageRate  周活跃用户流失率 上周活跃用户在本周没有登陆过游戏的用户数，除以上周的活跃人数。   
     /* 
      SELECT count(deviceid )FROM dinocap2hd WHERE 
YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('2012-04-10' ) AND dayPlayTime >0 AND isjailbreak = '0'*/
      
    // $weekWastageRate_query = mysql_query("select (select sum(deviceid) from dinocap2hd where (SELECT distinct deviceid FROM dinocap2hd   WHERE YEARWEEK(date_format(whatday,'%Y-%m-%d')) = YEARWEEK('$everylogdate[whatday]')-1 and dayIapMoney >0 and dayPlayTime >2) not in (SELECT  distinct deviceid FROM dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' )))/(SELECT count(distinct deviceid) FROM dinocap2hd   WHERE YEARWEEK(date_format(whatday,'%Y-%m-%d')) = YEARWEEK('$everylogdate[whatday]')-1 and dayIapMoney >0 and dayPlayTime >2)");
    $weekWastageRate_query = mysql_query("SELECT (SELECT count( DISTINCT deviceid )FROM `dinocap2hd` WHERE (SELECT count( DISTINCT deviceid ) FROM dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') -1 AND dayIapMoney >0 AND dayPlayTime >2 AND isjailbreak = '0') NOT IN (SELECT DISTINCT deviceid FROM dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]' ))AND isjailbreak = '0') / (SELECT count( DISTINCT deviceid )FROM dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]' ) -1 AND dayIapMoney >0 AND dayPlayTime >2 AND isjailbreak = '0' ) ");
     $weekWastageRate = mysql_fetch_array($weekWastageRate_query);
   // $weekWastageRate = 0;
    //weekPayRate  周活跃用户付费率 周付费用户数除以周活跃人数
    //$weekPayRate_query = mysql_query("select '$weekPayPesonrNum[0]'/'$weekActivePesonrNum[0]'");
    $weekPayRate_query = mysql_query("select (select count(distinct deviceid) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' ) and dayIapMoney > 0 AND isjailbreak = '0')/(SELECT count(distinct deviceid) FROM dinocap2hd   WHERE YEARWEEK(date_format(whatday,'%Y-%m-%d')) = YEARWEEK('$everylogdate[whatday]')-1 and dayIapMoney >0 and dayPlayTime >2 AND isjailbreak = '0')");
    $weekPayRate = mysql_fetch_array($weekPayRate_query);
    //weekLogPayRate周登陆用户付费率 周付费用户数除以周登陆人数
    $weekLogPayRate_query = mysql_query("select (select count(distinct deviceid) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' ) and dayIapMoney > 0 AND isjailbreak = '0')/(select count(distinct deviceid) from dinocap2hd where YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' ) AND isjailbreak = '0')");
    $weekLogPayRate = mysql_fetch_array($weekLogPayRate_query);
   //weekPayWastageRate  周付费用户流失率 上周有付费行为而本周7天未登陆的用户数除以上周的付费用户数    //sql查询慢,需要优化
   //SELECT count(id)  FROM  dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' ) -1 and dayIapMoney >0 and whatday = '2012-03-28' where 
    // $weekPayWastageRate_query = mysql_query("select (select count(deviceid) FROM  dinocap2hd where (SELECT distinct deviceid FROM dinocap2hd   WHERE YEARWEEK(date_format(whatday,'%Y-%m-%d')) = YEARWEEK('$everylogdate[whatday]')-1 and dayIapMoney >0) not in (SELECT  distinct deviceid FROM dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' )) and whatday = '$everylogdate[whatday]')/(SELECT distinct deviceid FROM dinocap2hd   WHERE YEARWEEK(date_format(whatday,'%Y-%m-%d')) = YEARWEEK('$everylogdate[whatday]')-1 and dayIapMoney >0 and whatday = '$everylogdate[whatday]')");
      $weekPayWastageRate_query = mysql_query("SELECT (SELECT count( DISTINCT deviceid )FROM `dinocap2hd` WHERE (SELECT count( DISTINCT deviceid ) FROM dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' ) -1 AND dayIapMoney >0 AND isjailbreak = '0') NOT IN (SELECT DISTINCT deviceid FROM dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' )) AND isjailbreak = '0') / (SELECT count( DISTINCT deviceid ) FROM dinocap2hd WHERE YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' ) -1 AND dayIapMoney >0 AND isjailbreak = '0' ) ");
     $weekPayWastageRate = mysql_fetch_array($weekPayWastageRate_query);
    //$weekPayWastageRate  = 0;
 //   var_dump($weekPayWastageRate);die;

   //本周总充值笔数除
   // $weekpayTimes_query = mysql_query("SELECT count(id)  FROM  dinocap2hd  where  dayIapMoney >0 and  YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK('$everylogdate[whatday]') and whatday = '$everylogdate[whatday]'");
   // $weekpayTimes = mysql_fetch_array($weekpayTimes_query);
       
    //$weekPayPesonrTime_query = mysql_query("select '$weekpayTimes[0]'/'$weekPayPesonrNum[0]'");
    //$weekPayPesonrTime = mysql_fetch_array($weekPayPesonrTime_query);
    //$weekPayPesonrTime = 0; //周付费用户人均充值笔数 (本周总充值笔数除以付费用户人数)
    	     $weekPayPesonrTime_query = mysql_query("SELECT (SELECT sum( dayPlayTime ) FROM dinocap2hd WHERE dayIapMoney >0 AND YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' ) AND isjailbreak = '0' ) / ( SELECT count( DISTINCT deviceid ) FROM dinocap2hd WHERE dayIapMoney >0 AND YEARWEEK( date_format( whatday, '%Y-%m-%d' ) ) = YEARWEEK( '$everylogdate[whatday]' ) AND isjailbreak = '0' )");
    $weekPayPesonrTime = mysql_fetch_array($weekPayPesonrTime_query);
    //var_dump($weekPayPesonrTime);die;
    
    $firstlogindata =  mysql_query("SELECT DISTINCT firstlogindata whatday FROM `dinocap2hd`");
	
	  //var_dump($dayActivePesonrNum);  //前一天select * from bean where date(usedate) = date_sub(curdate(),interval 1 day);
	  
   //dayTotalExp 每日人均经验获取
    $dayTotalExp_query = mysql_query("SELECT avg(player1DayExp+player2DayExp+player3DayExp+player4DayExp+player5DayExp)  FROM  dinocap2hd  where  whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $dayTotalExp = mysql_fetch_array($dayTotalExp_query);
    //player1DayExp 角色经验
    $player1DayExp_query = mysql_query("SELECT count(player1DayExp)  FROM  dinocap2hd  where player1DayExp > 0 and  whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $player1DayExp = mysql_fetch_array($player1DayExp_query);
    //player2DayExp 角色经验
    $player2DayExp_query = mysql_query("SELECT count(player2DayExp)  FROM  dinocap2hd  where player2DayExp > 0 and  whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $player2DayExp = mysql_fetch_array($player2DayExp_query);
    //player3DayExp 角色经验
    $player3DayExp_query = mysql_query("SELECT count(player3DayExp)  FROM  dinocap2hd  where player3DayExp > 0 and  whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $player3DayExp = mysql_fetch_array($player3DayExp_query);
    //player4DayExp 角色经验
    $player4DayExp_query = mysql_query("SELECT count(player4DayExp)  FROM  dinocap2hd  where player4DayExp > 0 and  whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $player4DayExp = mysql_fetch_array($player4DayExp_query);
    //player5DayExp 角色经验
    $player5DayExp_query = mysql_query("SELECT count(player5DayExp)  FROM  dinocap2hd  where player5DayExp > 0 and  whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $player5DayExp = mysql_fetch_array($player5DayExp_query);
    //var_dump($player2DayExp);die;
    // `avgplayer1DayExp` varchar(8) DEFAULT '0' COMMENT 'P1人物当天发生经验变化玩家的平均经验',
    $avgplayer1DayExp_query = mysql_query("SELECT avg(player1DayExp)  FROM  dinocap2hd  where player1DayExp > 0 and whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $avgplayer1DayExp = mysql_fetch_array($avgplayer1DayExp_query);
    // avgplayer2DayExp p2平均经验
    $avgplayer2DayExp_query = mysql_query("SELECT avg(player2DayExp)  FROM  dinocap2hd  where player2DayExp > 0 and whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $avgplayer2DayExp = mysql_fetch_array($avgplayer2DayExp_query);
    // avgplayer3DayExp p3平均经验
    $avgplayer3DayExp_query = mysql_query("SELECT avg(player3DayExp)  FROM  dinocap2hd  where player3DayExp > 0 and  whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $avgplayer3DayExp = mysql_fetch_array($avgplayer3DayExp_query);
    // avgplayer4DayExp p4平均经验
    $avgplayer4DayExp_query = mysql_query("SELECT avg(player4DayExp)  FROM  dinocap2hd  where player4DayExp > 0 and whatday ='$everylogdate[whatday]'and isjailbreak = '0'");
    $avgplayer4DayExp = mysql_fetch_array($avgplayer4DayExp_query);
    // avgplayer5DayExp p5平均经验
    $avgplayer5DayExp_query = mysql_query("SELECT avg(player5DayExp)  FROM  dinocap2hd  where player5DayExp > 0 and whatday ='$everylogdate[whatday]' and isjailbreak = '0'");
    $avgplayer5DayExp = mysql_fetch_array($avgplayer5DayExp_query);

    // p1等级分布 (1,2,....)
    $date = array('1' => array($p1date1Count, $date1), array($p1date2Count, $date2), array($p1date3Count, $date3), array($p1date4Count, $date4), array($p1date5Count, $date5), array($p1date6Count, $date6), array($p1date7Count, $date7), array($p1date8Count, $date8), array($p1date9Count, $date9), array($p1date10Count, $date10), array($p1date11Count, $date11), array($p1date12Count, $date12), array($p1date13Count, $date13), array($p1date14Count, $date14), array($p1date15Count, $date15), array($p1date16Count, $date16), array($p1date17Count, $date17), array($p1date18Count, $date18), array($p1date19Count, $date19), array($p1date20Count, $date20), array($p1date21Count, $date21));
    // $date1[] = 
    $date1_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date1_a = mysql_fetch_array($date1_query);
    $date1 = $date1_a[0];
    $p1date1Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date1Count_a = mysql_fetch_array($p1date1Count_query);
    $p1date1Count = $p1date1Count_a[0];
    $date2_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date2_a = mysql_fetch_array($date2_query);
    $date2 = $date2_a[0];
    $p1date2Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date2Count_a = mysql_fetch_array($p1date2Count_query);
    $p1date2Count = $p1date2Count_a[0];
    $date3_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date3_a = mysql_fetch_array($date3_query);
    $date3 = $date3_a[0];
    $p1date3Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date3Count_a = mysql_fetch_array($p1date3Count_query);
    $p1date3Count = $p1date3Count_a[0];
    $date4_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 4 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date4_a = mysql_fetch_array($date4_query);
    $date4 = $date4_a[0];
    $p1date4Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 4 and whatday ='$everylogdate[whatday]'");
    $p1date4Count_a = mysql_fetch_array($p1date4Count_query);
    $p1date4Count = $p1date4Count_a[0];
    $date5_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date5_a = mysql_fetch_array($date5_query);
    $date5 = $date5_a[0];
    $p1date5Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date5Count_a = mysql_fetch_array($p1date5Count_query);
    $p1date5Count = $p1date5Count_a[0];
    $date6_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date6_a = mysql_fetch_array($date6_query);
    $date6 = $date6_a[0];
    $p1date6Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date6Count_a = mysql_fetch_array($p1date6Count_query);
    $p1date6Count = $p1date6Count_a[0];
    $date7_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date7_a = mysql_fetch_array($date7_query);
    $date7 = $date7_a[0];
    $p1date7Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date7Count_a = mysql_fetch_array($p1date7Count_query);
    $p1date7Count = $p1date7Count_a[0];
    $date8_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date8_a = mysql_fetch_array($date8_query);
    $date8 = $date8_a[0];
    $p1date8Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date8Count_a = mysql_fetch_array($p1date8Count_query);
    $p1date8Count = $p1date8Count_a[0];
    $date9_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date9_a = mysql_fetch_array($date9_query);
    $date9 = $date9_a[0];
    $p1date9Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date9Count_a = mysql_fetch_array($p1date9Count_query);
    $p1date9Count = $p1date9Count_a[0];
    $date10_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date10_a = mysql_fetch_array($date10_query);
    $date10 = $date10_a[0];
    $p1date10Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date10Count_a = mysql_fetch_array($p1date10Count_query);
    $p1date10Count = $p1date10Count_a[0];
    $date11_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date11_a = mysql_fetch_array($date11_query);
    $date11 = $date11_a[0];
    $p1date11Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date11Count_a = mysql_fetch_array($p1date11Count_query);
    $p1date11Count = $p1date11Count_a[0];
    $date12_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date12_a = mysql_fetch_array($date12_query);
    $date12 = $date12_a[0];
    $p1date12Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date12Count_a = mysql_fetch_array($p1date12Count_query);
    $p1date12Count = $p1date12Count_a[0];
    $date13_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 21 and 25 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date13_a = mysql_fetch_array($date13_query);
    $date13 = $date13_a[0];
    $p1date13Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 21 and 25 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date13Count_a = mysql_fetch_array($p1date13Count_query);
    $p1date13Count = $p1date13Count_a[0];
    $date14_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 26 and 30 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date14_a = mysql_fetch_array($date14_query);
    $date14 = $date14_a[0];
    $p1date14Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 26 and 30 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date14Count_a = mysql_fetch_array($p1date14Count_query);
    $p1date14Count = $p1date14Count_a[0];
    $date15_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 31 and 40 and isjailbreak = '0')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date15_a = mysql_fetch_array($date15_query);
    $date15 = $date15_a[0];
    $p1date15Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date15Count_a = mysql_fetch_array($p1date15Count_query);
    $p1date15Count = $p1date15Count_a[0];
    $date16_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date16_a = mysql_fetch_array($date16_query);
    $date16 = $date16_a[0];
    $p1date16Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date16Count_a = mysql_fetch_array($p1date16Count_query);
    $p1date16Count = $p1date16Count_a[0];
    $date17_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date17_a = mysql_fetch_array($date17_query);
    $date17 = $date17_a[0];
    $p1date17Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date17Count_a = mysql_fetch_array($p1date17Count_query);
    $p1date17Count = $p1date17Count_a[0];
    $date18_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date18_a = mysql_fetch_array($date18_query);
    $date18 = $date18_a[0];
    $p1date18Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date18Count_a = mysql_fetch_array($p1date18Count_query);
    $p1date18Count = $p1date18Count_a[0];
    $date19_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 71 and 80 and isjailbreak = '0')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date19_a = mysql_fetch_array($date19_query);
    $date19 = $date19_a[0];
    $p1date19Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date19Count_a = mysql_fetch_array($p1date19Count_query);
    $p1date19Count = $p1date19Count_a[0];
    $date20_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date20_a = mysql_fetch_array($date20_query);
    $date20 = $date20_a[0];
    $p1date20Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date20Count_a = mysql_fetch_array($p1date20Count_query);
    $p1date20Count = $p1date20Count_a[0];
    $date21_query = mysql_query("SELECT concat(((select count(player1Level) from dinocap2hd where player1Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player1Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $date21_a = mysql_fetch_array($date21_query);
    $date21 = $date21_a[0];
    $p1date21Count_query = mysql_query("SELECT count(player1Level)  FROM  dinocap2hd  where player1Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p1date21Count_a = mysql_fetch_array($p1date21Count_query);
    $p1date21Count = $p1date21Count_a[0];
    $player1Level = array(json_encode($date));
    //var_dump( $player1Level[0]); die;
    // p2等级分布
    $p2date = array('1' => array($p2date1Count, $p2date1), array($p2date2Count, $p2date2), array($p2date3Count, $p2date3), array($p2date4Count, $p2date4), array($p2date5Count, $p2date5), array($p2date6Count, $p2date6), array($p2date7Count, $p2date7), array($p2date8Count, $p2date8), array($p2date9Count, $p2date9), array($p2date10Count, $p2date10), array($p2date11Count, $p2date11), array($p2date12Count, $p2date12), array($p2date13Count, $p2date13), array($p2date14Count, $p2date14), array($p2date15Count, $p2date15), array($p2date16Count, $p2date16), array($p2date17Count, $p2date17), array($p2date18Count, $p2date18), array($p2date19Count, $p2date19), array($p2date20Count, $p2date20), array($p2date21Count, $p2date21));
    // $date1[] = 
    $p2date1_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date1_a = mysql_fetch_array($p2date1_query);
    $p2date1 = $p2date1_a[0];
    $p2date1Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date1Count_a = mysql_fetch_array($p2date1Count_query);
    $p2date1Count = $p2date1Count_a[0];
    $p2date2_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date2_a = mysql_fetch_array($p2date2_query);
    $p2date2 = $p2date2_a[0];
    $p2date2Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date2Count_a = mysql_fetch_array($p2date2Count_query);
    $p2date2Count = $p2date2Count_a[0];
    $p2date3_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date3_a = mysql_fetch_array($p2date3_query);
    $p2date3 = $p2date3_a[0];
    $p2date3Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date3Count_a = mysql_fetch_array($p2date3Count_query);
    $p2date3Count = $p2date3Count_a[0];
    $p2date4_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 4)/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date4_a = mysql_fetch_array($p2date4_query);
    $p2date4 = $p2date4_a[0];
    $p2date4Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 4 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date4Count_a = mysql_fetch_array($p2date4Count_query);
    $p2date4Count = $p2date4Count_a[0];
    $p2date5_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date5_a = mysql_fetch_array($p2date5_query);
    $p2date5 = $p2date5_a[0];
    $p2date5Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date5Count_a = mysql_fetch_array($p2date5Count_query);
    $p2date5Count = $p2date5Count_a[0];
    $p2date6_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date6_a = mysql_fetch_array($p2date6_query);
    $p2date6 = $p2date6_a[0];
    $p2date6Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date6Count_a = mysql_fetch_array($p2date6Count_query);
    $p2date6Count = $p2date6Count_a[0];
    $p2date7_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date7_a = mysql_fetch_array($p2date7_query);
    $p2date7 = $p2date7_a[0];
    $p2date7Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date7Count_a = mysql_fetch_array($p2date7Count_query);
    $p2date7Count = $p2date7Count_a[0];
    $p2date8_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date8_a = mysql_fetch_array($p2date8_query);
    $p2date8 = $p2date8_a[0];
    $p2date8Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date8Count_a = mysql_fetch_array($p2date8Count_query);
    $p2date8Count = $p2date8Count_a[0];
    $p2date9_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date9_a = mysql_fetch_array($p2date9_query);
    $p2date9 = $p2date9_a[0];
    $p2date9Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date9Count_a = mysql_fetch_array($p2date9Count_query);
    $p2date9Count = $p2date9Count_a[0];
    $p2date10_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level = 10 and isjailbreak = '0')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date10_a = mysql_fetch_array($p2date10_query);
    $p2date10 = $p2date10_a[0];
    $p2date10Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date10Count_a = mysql_fetch_array($p2date10Count_query);
    $p2date10Count = $p2date10Count_a[0];
    $p2date11_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date11_a = mysql_fetch_array($p2date11_query);
    $p2date11 = $p2date11_a[0];
    $p2date11Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date11Count_a = mysql_fetch_array($p2date11Count_query);
    $p2date11Count = $p2date11Count_a[0];
    $p2date12_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 16 and 20)/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date12_a = mysql_fetch_array($p2date12_query);
    $p2date12 = $p2date12_a[0];
    $p2date12Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date12Count_a = mysql_fetch_array($p2date12Count_query);
    $p2date12Count = $p2date12Count_a[0];
    $p2date13_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 21 and 25 and isjailbreak = '0')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date13_a = mysql_fetch_array($p2date13_query);
    $p2date13 = $p2date13_a[0];
    $p2date13Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 21 and 25 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date13Count_a = mysql_fetch_array($p2date13Count_query);
    $p2date13Count = $p2date13Count_a[0];
    $p2date14_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 26 and 30 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date14_a = mysql_fetch_array($p2date14_query);
    $p2date14 = $p2date14_a[0];
    $p2date14Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 26 and 30 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date14Count_a = mysql_fetch_array($p2date14Count_query);
    $p2date14Count = $p2date14Count_a[0];
    $p2date15_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date15_a = mysql_fetch_array($p2date15_query);
    $p2date15 = $p2date15_a[0];
    $p2date15Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date15Count_a = mysql_fetch_array($p2date15Count_query);
    $p2date15Count = $p2date15Count_a[0];
    $p2date16_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date16_a = mysql_fetch_array($p2date16_query);
    $p2date16 = $p2date16_a[0];
    $p2date16Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 41 and 50 and isjailbreak = '0'");
    $p2date16Count_a = mysql_fetch_array($p2date16Count_query);
    $p2date16Count = $p2date16Count_a[0];
    $p2date17_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date17_a = mysql_fetch_array($p2date17_query);
    $p2date17 = $p2date17_a[0];
    $p2date17Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date17Count_a = mysql_fetch_array($p2date17Count_query);
    $p2date17Count = $p2date17Count_a[0];
    $p2date18_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 61 and 70 and isjailbreak = '0')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date18_a = mysql_fetch_array($p2date18_query);
    $p2date18 = $p2date18_a[0];
    $p2date18Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date18Count_a = mysql_fetch_array($p2date18Count_query);
    $p2date18Count = $p2date18Count_a[0];
    $p2date19_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date19_a = mysql_fetch_array($p2date19_query);
    $p2date19 = $p2date19_a[0];
    $p2date19Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date19Count_a = mysql_fetch_array($p2date19Count_query);
    $p2date19Count = $p2date19Count_a[0];
    $p2date20_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 81 and 90 and isjailbreak = '0')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date20_a = mysql_fetch_array($p2date20_query);
    $p2date20 = $p2date20_a[0];
    $p2date20Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date20Count_a = mysql_fetch_array($p2date20Count_query);
    $p2date20Count = $p2date20Count_a[0];
    $p2date21_query = mysql_query("SELECT concat(((select count(player2Level) from dinocap2hd where player2Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player2Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p2date21_a = mysql_fetch_array($p2date21_query);
    $p2date21 = $p2date21_a[0];
    $p2date21Count_query = mysql_query("SELECT count(player2Level)  FROM  dinocap2hd  where player2Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p2date21Count_a = mysql_fetch_array($p2date21Count_query);
    $p2date21Count = $p2date21Count_a[0];
    $player2Level = array(json_encode($p2date));
    // p3等级分布
    $p3date = array('1' => array($p3date1Count, $p3date1), array($p3date2Count, $p3date2), array($p3date3Count, $p3date3), array($p3date4Count, $p3date4), array($p3date5Count, $p3date5), array($p3date6Count, $p3date6), array($p3date7Count, $p3date7), array($p3date8Count, $p3date8), array($p3date9Count, $p3date9), array($p3date10Count, $p3date10), array($p3date11Count, $p3date11), array($p3date12Count, $p3date12), array($p3date13Count, $p3date13), array($p3date14Count, $p3date14), array($p3date15Count, $p3date15), array($p3date16Count, $p3date16), array($p3date17Count, $p3date17), array($p3date18Count, $p3date18), array($p3date19Count, $p3date19), array($p3date20Count, $p3date20), array($p3date21Count, $p3date21));
    // $date1[] = 
    $p3date1_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date1_a = mysql_fetch_array($p3date1_query);
    $p3date1 = $p3date1_a[0];

    $p3date1Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date1Count_a = mysql_fetch_array($p3date1Count_query);
    $p3date1Count = $p3date1Count_a[0];
    $p3date2_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date2_a = mysql_fetch_array($p3date2_query);
    $p3date2 = $p3date2_a[0];
    $p3date2Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date2Count_a = mysql_fetch_array($p3date2Count_query);
    $p3date2Count = $p3date2Count_a[0];
    $p3date3_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date3_a = mysql_fetch_array($p3date3_query);
    $p3date3 = $p3date3_a[0];
    $p3date3Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date3Count_a = mysql_fetch_array($p3date3Count_query);
    $p3date3Count = $p3date3Count_a[0];
    $p3date4_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 4 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date4_a = mysql_fetch_array($p3date4_query);
    $p3date4 = $p3date4_a[0];
    $p3date4Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player4Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date4Count_a = mysql_fetch_array($p3date4Count_query);
    $p3date4Count = $p3date4Count_a[0];
    $p3date5_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date5_a = mysql_fetch_array($p3date5_query);
    $p3date5 = $p3date5_a[0];
    $p3date5Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date5Count_a = mysql_fetch_array($p3date5Count_query);
    $p3date5Count = $p3date5Count_a[0];
    $p3date6_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date6_a = mysql_fetch_array($p3date6_query);
    $p3date6 = $p3date6_a[0];
    $p3date6Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date6Count_a = mysql_fetch_array($p3date6Count_query);
    $p3date6Count = $p3date6Count_a[0];
    $p3date7_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date7_a = mysql_fetch_array($p3date7_query);
    $p3date7 = $p3date7_a[0];
    $p3date7Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date7Count_a = mysql_fetch_array($p3date7Count_query);
    $p3date7Count = $p3date7Count_a[0];
    $p3date8_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date8_a = mysql_fetch_array($p3date8_query);
    $p3date8 = $p3date8_a[0];
    $p3date8Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date8Count_a = mysql_fetch_array($p3date8Count_query);
    $p3date8Count = $p3date8Count_a[0];
    $p3date9_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date9_a = mysql_fetch_array($p3date9_query);
    $p3date9 = $p3date9_a[0];
    $p3date9Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date9Count_a = mysql_fetch_array($p3date9Count_query);
    $p3date9Count = $p3date9Count_a[0];
    $p3date10_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date10_a = mysql_fetch_array($p3date10_query);
    $p3date10 = $p3date10_a[0];
    $p3date10Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date10Count_a = mysql_fetch_array($p3date10Count_query);
    $p3date10Count = $p3date10Count_a[0];
    $p3date11_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date11_a = mysql_fetch_array($p3date11_query);
    $p3date11 = $p3date11_a[0];
    $p3date11Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date11Count_a = mysql_fetch_array($p3date11Count_query);
    $p3date11Count = $p3date11Count_a[0];
    $p3date12_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date12_a = mysql_fetch_array($p3date12_query);
    $p3date12 = $p3date12_a[0];
    $p3date12Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date12Count_a = mysql_fetch_array($p3date12Count_query);
    $p3date12Count = $p3date12Count_a[0];
    $p3date13_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 21 and 25 and isjailbreak = '0')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date13_a = mysql_fetch_array($p3date13_query);
    $p3date13 = $p3date13_a[0];
    $p3date13Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 21 and 25 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date13Count_a = mysql_fetch_array($p3date13Count_query);
    $p3date13Count = $p3date13Count_a[0];
    $p3date14_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 26 and 30 and isjailbreak = '0')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date14_a = mysql_fetch_array($p3date14_query);
    $p3date14 = $p3date14_a[0];
    $p3date14Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 26 and 30 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date14Count_a = mysql_fetch_array($p3date14Count_query);
    $p3date14Count = $p3date14Count_a[0];
    $p3date15_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date15_a = mysql_fetch_array($p3date15_query);
    $p3date15 = $p3date15_a[0];
    $p3date15Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date15Count_a = mysql_fetch_array($p3date15Count_query);
    $p3date15Count = $p3date15Count_a[0];
    $p3date16_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date16_a = mysql_fetch_array($p3date16_query);
    $p3date16 = $p3date16_a[0];
    $p3date16Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date16Count_a = mysql_fetch_array($p3date16Count_query);
    $p3date16Count = $p3date16Count_a[0];
    $p3date17_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date17_a = mysql_fetch_array($p3date17_query);
    $p3date17 = $p3date17_a[0];
    $p3date17Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date17Count_a = mysql_fetch_array($p3date17Count_query);
    $p3date17Count = $p3date17Count_a[0];
    $p3date18_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 61 and 70 and isjailbreak = '0')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date18_a = mysql_fetch_array($p3date18_query);
    $p3date18 = $p3date18_a[0];
    $p3date18Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date18Count_a = mysql_fetch_array($p3date18Count_query);
    $p3date18Count = $p3date18Count_a[0];
    $p3date19_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date19_a = mysql_fetch_array($p3date19_query);
    $p3date19 = $p3date19_a[0];
    $p3date19Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date19Count_a = mysql_fetch_array($p3date19Count_query);
    $p3date19Count = $p3date19Count_a[0];
    $p3date20_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date20_a = mysql_fetch_array($p3date20_query);
    $p3date20 = $p3date20_a[0];
    $p3date20Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date20Count_a = mysql_fetch_array($p3date20Count_query);
    $p3date20Count = $p3date20Count_a[0];
    $p3date21_query = mysql_query("SELECT concat(((select count(player3Level) from dinocap2hd where player3Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player3Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p3date21_a = mysql_fetch_array($p3date21_query);
    $p3date21 = $p3date21_a[0];
    $p3date21Count_query = mysql_query("SELECT count(player3Level)  FROM  dinocap2hd  where player3Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p3date21Count_a = mysql_fetch_array($p3date21Count_query);
    $p3date21Count = $p3date21Count_a[0];

    $player3Level = array(json_encode($p3date));
    // p4等级分布
    $p4date = array('1' => array($p4date1Count, $p4date1), array($p4date2Count, $p4date2), array($p4date3Count, $p4date3), array($p4date4Count, $p4date4), array($p4date5Count, $p4date5), array($p4date6Count, $p4date6), array($p4date7Count, $p4date7), array($p4date8Count, $p4date8), array($p4date9Count, $p4date9), array($p4date10Count, $p4date10), array($p4date11Count, $p4date11), array($p4date12Count, $p4date12), array($p4date13Count, $p4date13), array($p4date14Count, $p4date14), array($p4date15Count, $p4date15), array($p4date16Count, $p4date16), array($p4date17Count, $p4date17), array($p4date18Count, $p4date18), array($p4date19Count, $p4date19), array($p4date20Count, $p4date20), array($p4date21Count, $p4date21));
    // $date1[] = 
    $p4date1_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date1_a = mysql_fetch_array($p4date1_query);
    $p4date1 = $p4date1_a[0];
    $p4date1Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date1Count_a = mysql_fetch_array($p4date1Count_query);
    $p4date1Count = $p4date1Count_a[0];

    $p4date2_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date2_a = mysql_fetch_array($p4date2_query);
    $p4date2 = $p4date2_a[0];
    $p4date2Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date2Count_a = mysql_fetch_array($p4date2Count_query);
    $p4date2Count = $p4date2Count_a[0];
    $p4date3_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date3_a = mysql_fetch_array($p4date3_query);
    $p4date3 = $p4date3_a[0];
    $p4date3Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date3Count_a = mysql_fetch_array($p4date3Count_query);
    $p4date3Count = $p4date3Count_a[0];
    $p4date4_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 4 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date4_a = mysql_fetch_array($p4date4_query);
    $p4date4 = $p4date4_a[0];
    $p4date4Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 4 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date4Count_a = mysql_fetch_array($p4date4Count_query);
    $p4date4Count = $p4date4Count_a[0];
    $p4date5_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date5_a = mysql_fetch_array($p4date5_query);
    $p4date5 = $p4date5_a[0];
    $p4date5Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date5Count_a = mysql_fetch_array($p4date5Count_query);
    $p4date5Count = $p4date5Count_a[0];
    $p4date6_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date6_a = mysql_fetch_array($p4date6_query);
    $p4date6 = $p4date6_a[0];
    $p4date6Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date6Count_a = mysql_fetch_array($p4date6Count_query);
    $p4date6Count = $p4date6Count_a[0];
    $p4date7_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date7_a = mysql_fetch_array($p4date7_query);
    $p4date7 = $p4date7_a[0];
    $p4date7Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date7Count_a = mysql_fetch_array($p4date7Count_query);
    $p4date7Count = $p4date7Count_a[0];
    $p4date8_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date8_a = mysql_fetch_array($p4date8_query);
    $p4date8 = $p4date8_a[0];
    $p4date8Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date8Count_a = mysql_fetch_array($p4date8Count_query);
    $p4date8Count = $p4date8Count_a[0];
    $p4date9_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date9_a = mysql_fetch_array($p4date9_query);
    $p4date9 = $p4date9_a[0];
    $p4date9Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date9Count_a = mysql_fetch_array($p4date9Count_query);
    $p4date9Count = $p4date9Count_a[0];
    $p4date10_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date10_a = mysql_fetch_array($p4date10_query);
    $p4date10 = $p4date10_a[0];
    $p4date10Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date10Count_a = mysql_fetch_array($p4date10Count_query);
    $p4date10Count = $p4date10Count_a[0];
    $p4date11_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date11_a = mysql_fetch_array($p4date11_query);
    $p4date11 = $p4date11_a[0];
    $p4date11Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date11Count_a = mysql_fetch_array($p4date11Count_query);
    $p4date11Count = $p4date11Count_a[0];
    $p4date12_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date12_a = mysql_fetch_array($p4date12_query);
    $p4date12 = $p4date12_a[0];
    $p4date12Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date12Count_a = mysql_fetch_array($p4date12Count_query);
    $p4date12Count = $p4date12Count_a[0];
    $p4date13_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 21 and 25 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date13_a = mysql_fetch_array($p4date13_query);
    $p4date13 = $p4date13_a[0];
    $p4date13Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 21 and 25 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date13Count_a = mysql_fetch_array($p4date13Count_query);
    $p4date13Count = $p4date13Count_a[0];
    $p4date14_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 26 and 30 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date14_a = mysql_fetch_array($p4date14_query);
    $p4date14 = $p4date14_a[0];
    $p4date14Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 26 and 30 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date14Count_a = mysql_fetch_array($p4date14Count_query);
    $p4date14Count = $p4date14Count_a[0];
    $p4date15_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date15_a = mysql_fetch_array($p4date15_query);
    $p4date15 = $p4date15_a[0];
    $p4date15Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date15Count_a = mysql_fetch_array($p4date15Count_query);
    $p4date15Count = $p4date15Count_a[0];
    $p4date16_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date16_a = mysql_fetch_array($p4date16_query);
    $p4date16 = $p4date16_a[0];
    $p4date16Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date16Count_a = mysql_fetch_array($p4date16Count_query);
    $p4date16Count = $p4date16Count_a[0];
    $p4date17_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date17_a = mysql_fetch_array($p4date17_query);
    $p4date17 = $p4date17_a[0];
    $p4date17Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date17Count_a = mysql_fetch_array($p4date17Count_query);
    $p4date17Count = $p4date17Count_a[0];
    $p4date18_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date18_a = mysql_fetch_array($p4date18_query);
    $p4date18 = $p4date18_a[0];
    $p4date18Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date18Count_a = mysql_fetch_array($p4date18Count_query);
    $p4date18Count = $p4date18Count_a[0];
    $p4date19_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date19_a = mysql_fetch_array($p4date19_query);
    $p4date19 = $p4date19_a[0];
    $p4date19Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date19Count_a = mysql_fetch_array($p4date19Count_query);
    $p4date19Count = $p4date19Count_a[0];
    $p4date20_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date20_a = mysql_fetch_array($p4date20_query);
    $p4date20 = $p4date20_a[0];
    $p4date20Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date20Count_a = mysql_fetch_array($p4date20Count_query);
    $p4date20Count = $p4date20Count_a[0];
    $p4date21_query = mysql_query("SELECT concat(((select count(player4Level) from dinocap2hd where player4Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player4Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p4date21_a = mysql_fetch_array($p4date21_query);
    $p4date21 = $p4date21_a[0];
    $p4date21Count_query = mysql_query("SELECT count(player4Level)  FROM  dinocap2hd  where player4Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p4date21Count_a = mysql_fetch_array($p4date21Count_query);
    $p4date21Count = $p4date21Count_a[0];
    $player4Level = array(json_encode($p4date));
    // p5等级分布(人数,所占百分比)
    $p5date = array('1' => array($p5date1Count, $p5date1), array($p5date2Count, $p5date2), array($p5date3Count, $p5date3), array($p5date4Count, $p5date4), array($p5date5Count, $p5date5), array($p5date6Count, $p5date6), array($p5date7Count, $p5date7), array($p5date8Count, $p5date8), array($p5date9Count, $p5date9), array($p5date10Count, $p5date10), array($p5date11Count, $p5date11), array($p5date12Count, $p5date12), array($p5date13Count, $p5date13), array($p5date14Count, $p5date14), array($p5date15Count, $p5date15), array($p5date16Count, $p5date16), array($p5date17Count, $p5date17), array($p5date18Count, $p5date18), array($p5date19Count, $p5date19), array($p5date20Count, $p5date20), array($p5date21Count, $p5date21));
    // $date1[] = 
    $p5date1_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date1_a = mysql_fetch_array($p5date1_query);
    $p5date1 = $p5date1_a[0];

    $p5date1Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 1 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date1Count_a = mysql_fetch_array($p5date1Count_query);
    $p5date1Count = $p5date1Count_a[0];
    // $date1 = $date1_a[0]
    $p5date2_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date2_a = mysql_fetch_array($p5date2_query);
    $p5date2 = $p5date2_a[0];
    $p5date2Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 2 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date2Count_a = mysql_fetch_array($p5date2Count_query);
    $p5date2Count = $p5date2Count_a[0];

    $p5date3_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date3_a = mysql_fetch_array($p5date3_query);
    $p5date3 = $p5date3_a[0];
    $p5date3Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 3 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date3Count_a = mysql_fetch_array($p5date3Count_query);
    $p5date3Count = $p5date3Count_a[0];

    $p5date4_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 4 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date4_a = mysql_fetch_array($p5date4_query);
    $p5date4 = $p5date4_a[0];
    $p5date4Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 4 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date4Count_a = mysql_fetch_array($p5date4Count_query);
    $p5date4Count = $p5date4Count_a[0];
    $p5date5_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date5_a = mysql_fetch_array($p5date5_query);
    $p5date5 = $p5date5_a[0];
    $p5date5Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 5 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date5Count_a = mysql_fetch_array($p5date5Count_query);
    $p5date5Count = $p5date5Count_a[0];
    $p5date6_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date6_a = mysql_fetch_array($p5date6_query);
    $p5date6 = $p5date6_a[0];
    $p5date6Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 6 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date6Count_a = mysql_fetch_array($p5date6Count_query);
    $p5date6Count = $p5date6Count_a[0];
    $p5date7_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 7 and isjailbreak = '0')/(select count(player5Level) from dinocap2hd where isjailbreak = '0'))*100,'%')");
    $p5date7_a = mysql_fetch_array($p5date7_query);
    $p5date7 = $p5date7_a[0];
    $p5date7Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 7 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date7Count_a = mysql_fetch_array($p5date7Count_query);
    $p5date7Count = $p5date7Count_a[0];
    $p5date8_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date8_a = mysql_fetch_array($p5date8_query);
    $p5date8 = $p5date8_a[0];
    $p5date8Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 8 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date8Count_a = mysql_fetch_array($p5date8Count_query);
    $p5date8Count = $p5date8Count_a[0];
    $p5date9_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 9 and isjailbreak = '0')/(select count(player5Level) from dinocap2hd where isjailbreak = '0'))*100,'%')");
    $p5date9_a = mysql_fetch_array($p5date9_query);
    $p5date9 = $p5date9_a[0];
    $p5date9Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 9 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date9Count_a = mysql_fetch_array($p5date9Count_query);
    $p5date9Count = $p5date9Count_a[0];
    $p5date10_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date10_a = mysql_fetch_array($p5date10_query);
    $p5date10 = $p5date10_a[0];
    $p5date10Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level = 10 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date10Count_a = mysql_fetch_array($p5date10Count_query);
    $p5date10Count = $p5date10Count_a[0];
    $p5date11_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date11_a = mysql_fetch_array($p5date11_query);
    $p5date11 = $p5date11_a[0];
    $p5date11Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 11 and 15 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date11Count_a = mysql_fetch_array($p5date11Count_query);
    $p5date11Count = $p5date11Count_a[0];
    $p5date12_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date12_a = mysql_fetch_array($p5date12_query);
    $p5date12 = $p5date12_a[0];
    $p5date12Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 16 and 20 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date12Count_a = mysql_fetch_array($p5date12Count_query);
    $p5date12Count = $p5date12Count_a[0];
    $p5date13_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 21 and 25 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date13_a = mysql_fetch_array($p5date13_query);
    $p5date13 = $p5date13_a[0];
    $p5date13Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 21 and 25 and isjailbreak = '0'");
    $p5date13Count_a = mysql_fetch_array($p5date13Count_query);
    $p5date13Count = $p5date13Count_a[0];
    $p5date14_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 26 and 30 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date14_a = mysql_fetch_array($p5date14_query);
    $p5date14 = $p5date14_a[0];
    $p5date14Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 26 and 30 and isjailbreak = '0'");
    $p5date14Count_a = mysql_fetch_array($p5date14Count_query);
    $p5date14Count = $p5date14Count_a[0];
    $p5date15_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date15_a = mysql_fetch_array($p5date15_query);
    $p5date15 = $p5date15_a[0];
    $p5date15Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 31 and 40 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date15Count_a = mysql_fetch_array($p5date15Count_query);
    $p5date15Count = $p5date15Count_a[0];
    $p5date16_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date16_a = mysql_fetch_array($p5date16_query);
    $p5date16 = $p5date16_a[0];
    $p5date16Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 41 and 50 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date16Count_a = mysql_fetch_array($p5date16Count_query);
    $p5date16Count = $p5date16Count_a[0];
    $p5date17_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date17_a = mysql_fetch_array($p5date17_query);
    $p5date17 = $p5date17_a[0];
    $p5date17Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 51 and 60 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date17Count_a = mysql_fetch_array($p5date17Count_query);
    $p5date17Count = $p5date17Count_a[0];
    $p5date18_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date18_a = mysql_fetch_array($p5date18_query);
    $p5date18 = $p5date18_a[0];
    $p5date18Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date18Count_a = mysql_fetch_array($p5date18Count_query);
    $p5date18Count = $p5date18Count_a[0];
    $p5date18Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 61 and 70 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date18Count_a = mysql_fetch_array($p5date18Count_query);
    $p5date18Count = $p5date18Count_a[0];
    $p5date19_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date19_a = mysql_fetch_array($p5date19_query);
    $p5date19 = $p5date19_a[0];
    $p5date19Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 71 and 80 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date19Count_a = mysql_fetch_array($p5date19Count_query);
    $p5date19Count = $p5date19Count_a[0];
    $p5date20_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date20_a = mysql_fetch_array($p5date20_query);
    $p5date20 = $p5date20_a[0];
    $p5date20Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 81 and 90 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date20Count_a = mysql_fetch_array($p5date20Count_query);
    $p5date20Count = $p5date20Count_a[0];
    $p5date21_query = mysql_query("SELECT concat(((select count(player5Level) from dinocap2hd where player5Level between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]')/(select count(player5Level) from dinocap2hd where isjailbreak = '0' and whatday ='$everylogdate[whatday]'))*100,'%')");
    $p5date21_a = mysql_fetch_array($p5date21_query);
    $p5date21 = $p5date21_a[0];
    $p5date21Count_query = mysql_query("SELECT count(player5Level)  FROM  dinocap2hd  where player5Level  between 91 and 100 and isjailbreak = '0' and whatday ='$everylogdate[whatday]'");
    $p5date21Count_a = mysql_fetch_array($p5date21Count_query);
    $p5date21Count = $p5date21Count_a[0];

    $player5Level = array(json_encode($p5date));

$sql="REPLACE INTO report_nojailbreak (loginPersonNum,activePesonrNum,weekPayPesonrNum, totalDayTotalTime,
                         dayTotalTime,totalDayGetMoney,totalDayRecharge,logdate,activePesonrTime,dayUsedMoney,totalDayUsedMoney,
                          dayLoginPersonNum,totalDayPlayTime,totalDayNewusers,dayActivePesonrNum,dayActivePesonrTime,
                          weekActivePesonrNum,weekLoyalPesonrNum,weekCorePesonrNum,newPayPesonrNum,paytimes,payPesonrNum,dayIAPGetMoney,avgDayMoney,
                          dayNowMoney,dayRechargeNum,weekPayARPU,weekActiveARPU,weekLogARPU,weekLogPayRate,
                          weekPayRate,weekPayPesonrTime,iap1,iap2,iap3,iap4,iap5,iap6,totalplayer1DayExp,totalplayer2DayExp,totalplayer3DayExp,totalplayer4DayExp,totalplayer5DayExp,
                        avgplayer1DayExp,avgplayer2DayExp,avgplayer3DayExp,avgplayer4DayExp,avgplayer5DayExp,player1Level,
                        player2Level,player3Level,player4Level,player5Level,dayTotalExp,weekPayWastageRate,weekWastageRate) 
                  VALUES('$loginPersonNum[0]','$activePesonrNum[0]','$weekPayPesonrNum[0]', '$totalDayTotalTime[0]',
                  '$dayTotalTime[0]','$totalDayGetMoney[0]','$totalDayRecharge[0]','$everylogdate[whatday]','$activePesonrTime[0]','$dayUsedMoney[0]','$totalDayUsedMoney[0]',
                  '$dayLoginPersonNum[0]','$totalDayPlayTime[0]','$totalDayNewusers[0]','$dayActivePesonrNum[0]','$dayActivePesonrTime[0]',
                  '$weekActivePesonrNum[0]','$weekLoyalPesonrNum[0]','$weekCorePesonrNum[0]','$newPayPesonrNum[0]','$paytimes[0]','$PayPesonrNum[0]','$dayIAPGetMoney[0]','$avgDayMoney[0]',
                  '$dayNowMoney[0]','$dayRechargeNum[0]','$weekPayARPU[0]','$weekActiveARPU[0]','$weekLogARPU[0]','$weekLogPayRate[0]',
                  '$weekPayRate[0]','$weekPayPesonrTime[0]','$iap1[0]','$iap2[0]','$iap3[0]','$iap4[0]','$iap5[0]','$iap6[0]','$player1DayExp[0]',
                  '$player2DayExp[0]','$player3DayExp[0]','$player4DayExp[0]','$player5DayExp[0]',
                  '$avgplayer1DayExp[0]','$avgplayer2DayExp[0]','$avgplayer3DayExp[0]','$avgplayer4DayExp[0]','$avgplayer5DayExp[0]','$player1Level[0]',
                  '$player2Level[0]','$player3Level[0]','$player4Level[0]','$player5Level[0]','$dayTotalExp[0]','$weekPayWastageRate[0]','$weekWastageRate[0]')";

 
$query= @mysql_query($sql,$connection) or die(mysql_error());  

}
?>
